using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableWorldBossStrongholdDao:DaoBase<TableWorldBossStronghold>
    {
        public override void AddPrimaryIndex(TableWorldBossStronghold model)
        {
            cachePrimary[model.strongholdId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableWorldBossStronghold.txt";
        }

        protected override TableWorldBossStronghold ParseRowData(string[] rowData)
        {
            TableWorldBossStronghold data = new TableWorldBossStronghold();
			data.strongholdId = rowData [0];

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.DailyId = 0;
            }
            else
            {
                data.DailyId = int.Parse(rowData[1]);
            }
			data.StrongholdStyleId = rowData [2];
			data.StrongholdPos = rowData [3];

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.StrongholdType = 0;
            }
            else
            {
                data.StrongholdType = int.Parse(rowData[4]);
            }

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.StrongholdCD = 0;
            }
            else
            {
                data.StrongholdCD = double.Parse(rowData[5]);
            }

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.StrongholdTotalEffectTime = 0;
            }
            else
            {
                data.StrongholdTotalEffectTime = int.Parse(rowData[6]);
            }
			data.PreBattleInfId = rowData [7];

            if (string.IsNullOrEmpty(rowData[8]))
            {
                data.StrongholdMaxRound = 0;
            }
            else
            {
                data.StrongholdMaxRound = int.Parse(rowData[8]);
            }
			data.StrongholdEffectMountId = rowData [9];
			data.StrongholdEffectLastId = rowData [10];
			data.StrongholdEffectOffId = rowData [11];

            return data;
        }


        public override void AddOneIndex(TableWorldBossStronghold model)
        {
            if (!cacheOneIndex.ContainsKey(model.DailyId.ToString()))
            {
                cacheOneIndex[model.DailyId.ToString()] = new List<TableWorldBossStronghold>();
            }
            cacheOneIndex[model.DailyId.ToString()].Add(model);
        }
    

    }

}
